package com.itbaizhan.mongotest.service.impl;

import com.itbaizhan.mongotest.dao.OrderDao;
import com.itbaizhan.mongotest.entity.Orders;
import com.itbaizhan.mongotest.repository.OrdersRepository;
import com.itbaizhan.mongotest.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
  /*调用dao层的接口*/
   @Autowired
   private OrderDao orderDao;

   @Autowired
   private OrdersRepository ordersRepository;
    @Override
    public List<Orders> getOrdersByName(String name) {
        return orderDao.findOrdersByName(name);
    }

    /*MongoRepository方式  下一步controller层*/
    @Override
    public List<Orders> getOrdersByName2(String name) {
        return ordersRepository.findByName(name);
    }
}
